import { getAction, deleteAction, putAction, postAction, httpAction, uploadAction, fromDataPostAction } from '@/api/manage'
import { axios as request } from '@/utils/request'

//出入库任务管理-出入库待办任务数量查询
export const inOUtNumApi = (params) => getAction("/wms/boundTask/getWmsInOutNum", params)
//出库任务管理-分页列表查询
export const outListApi = (params) => getAction("/wms/boundTask/outList", params)
//库管类型出入库类型
export const statusApi = (params) => getAction("/wms/boundTask/getWmsInOutTaskTypeList", params)
//出库标记完成
export const outSignApi = (params) => getAction("/wms/boundTask/updateOutTaskStatus", params)
//入库任务管理-分页列表查询
export const inListApi = (params) => getAction("/wms/boundTask/inList", params)
//出库标记完成
export const inSignApi = (params) => getAction("/wms/boundTask/updateInTaskStatus", params)
//已办任务分页列表查询
export const alreadyListApi = (params) => getAction("/wms/boundTask/list", params)
//出库明细列表
export const outLIstDetailApi = (params) => getAction("/wms/boundTask/getOutTaskDetails", params)
//仓库下拉列表
export const stockListApi = (params) => getAction("/wms/wmsWarehouse/queryList", params)
//入库明细列表
export const inLIstDetailApi = (params) => getAction("/wms/boundTask/getInTaskDetails", params)
//批量出入库
export const batchStockApi = (data) => postAction("/wms/wmsWarehouseOperate/add", data)
//出库任务管理-选择仓库查询物资清单
export const stockOfGoodApi = (params) => getAction("/wms/boundTask/getOutGoodsList", params)
//出入库记录-按商品分页列表查询
export const byGoodApi = (params) => getAction("/wms/wmsWarehouseOperate/listByGoods", params)
//出入库记录管理-出入库类型下拉列表
export const outAinApi = (params) => getAction("/wms/wmsWarehouseOperate/getWmsInOutTaskTypeList", params)
//出入库记录-按商品分页列表查询
export const byOrderApi = (params) => getAction("/wms/wmsWarehouseOperate/listByOrder", params)
//仓库物资管理-新建出入库清单选择仓库查询物资列表
// export const queryGoodApi = (params) => getAction("/wms/wmsWarehouse/getOutGoodsList", params)
export const queryGoodApi = (params) => getAction("/wms/wmsWarehouse/getOutGoodsListForAllot", params)
//入库单获取商品列表
export const inStockGoodApi = (params) => getAction("/wms/goods/getGoodsList", params)
//出入库记录-通过id查询
export const queryByIdApi = (params) => getAction("/wms/wmsWarehouseOperate/queryById", params)
//出入库记录-通过id查询明细列表
export const queryListApi = (params) => getAction("/wms/wmsWarehouseOperate/queryPageListById", params)
//出入库记录-出入库单详情关联出入库任务商品分页
export const queryListByIdApi = (params) => getAction("/wms/wmsWarehouseOperate/queryListById", params)
//树数据
export const treeDataApi = (params) => getAction("/dict/erpDict/treeList", params)
//查询字典詳情
export const getDictTextApi = (params) => getAction("/dict/erpDict/getDictText", params)
//字典恢复初始化设置
export const resetPubDictApi = (data) => postAction("/dict/erpDict/dictReset", data)
//普通字典新增
export const pubDictAddApi = (data) => postAction("/sys/dictItem/add", data)
//普通字典编辑
export const pubDictEditApi = (params) => putAction("/sys/dictItem/edit", params)
//普通字典删除
export const pubDictDeleteApi = (params) => deleteAction("/sys/dictItem/delete", params)
//普通字典拖拽
export const dictSortApi = (data) => postAction("/dict/erpDict/dictSort", data)
//分类字典添加一级分类
export const addOneClassApi = (data) => postAction("/sys/category/add", data)
//分类字典编辑
export const classDictEditApi = (params) => putAction("/sys/category/edit", params)
//分类字典删除
export const classDictDeleteApi = (params) => deleteAction("/sys/category/delete", params)
//查询待我处理申请
export const waiterDealApi = (params) => getAction("/proc/apply/queryTask", params)
//查询申请数量
export const applyNumApi = (params) => getAction("/proc/apply/queryApplyNum", params)
//查询已处理申请、查询已发起申请、抄送给我的申请
export const otherApplyApi = (params) => getAction("/proc/apply/queryApply", params)
// 调拨单列表查询
export const stockAllocationListApi = (params) => getAction("/wms/wmsStockAllot/list", params)
// 调拨单新建
export const stockAllocationAddApi = (data) => postAction("/wms/wmsStockAllot/add", data)
// 调拨单新建-仓库查询
export const stockAllocQueryWarehouse = (params) => getAction("/wms/wmsWarehouse/list", params)
// 新建调拨单-调出仓库查询该仓库
export const stockAllocQueryWarehouseGoods = (params) => getAction("/wms/goods/getGoodsListByWarehouseId", params)

// 新建查询出入库，出入库类型
// export const OutInBoundTypeApi = (params) => getAction("/wms/wmsWarehouseOperate/getWmsInOutTaskTypeList", params)
export const OutInBoundTypeApi = (params) => getAction("/wms/wmsWarehouseOperate/getNewInOutTypeList", params)
// 申请类型
export const getProcDictList = (params) => getAction("/home/homePage/getProcDictList", params)

// 新建调拨单-查商品数是否超出
export const checkGoodsExceedApi = (params) => getAction("/wms/goods/getGoodsQualifiedAndImperfectNum", params)
//调拨单详情
export const allocationDetail = (params) => getAction("/wms/wmsStockAllot/queryById", params)
// 设备管理-设备保养-保养任务-列表
export const maintenanceTaskList = (params) => getAction("/mess/messDeviceMaintainTask/list", params)
// 设备管理-设备保养-保养任务-保养项目
export const maintenanceItemList = (params) => getAction("/mess/messDeviceMaintainItem/list", params)
// 设备管理-设备保养-保养任务-保养任务详情
export const maintenanceDetail = (params) => getAction("/mess/messDeviceMaintainTask/queryById", params)
// 设备管理-设备保养-保养任务-新建保养任务
export const maintenanceTaskAdd = (data) => postAction("/mess/messDeviceMaintainTask/add", data)
// 设备管理-设备保养-保养任务-汇报接口
export const maintenanceTaskReport = (data) => postAction("/mess/messDeviceMaintainTask/report", data)
// 获取系统设置
export const querySysSet = (params) => getAction("/system/sysSetting/queryByKey", params)
// 修改系统设置
export const sysSetEdit = (params) => putAction("/system/sysSetting/edit", params)
// 批量删除出入库记录
export const batchDel = (params) => putAction("/wms/wmsWarehouseOperate/batchDel", params)
// 销售报表-待收款销售合同分页列表
export const salesContractPendingPaymentList = (params) => getAction("/erp/saleReportForms/pendingSalesContractPageList", params)
// 销售报表-待收款销售合同统计
export const salesContractPendingPaymentStatistics = (params) => getAction("/erp/saleReportForms/getPendingSalesContractNum", params)
//申请表单菜单列表
export const commonlyQueryApplyForm = (params) => getAction("/commonly/app/queryApplyForm", params)

//出库子列表
// export const getOutTaskGoodsByTaskId = (params) => getAction("/wms/boundTask/getOutTaskGoodsByTaskId", params)
export function getOutTaskGoodsByTaskId(data) {
  return request({
    url: `/wms/boundTask/getOutTaskGoodsByTaskId?taskId=${data.taskId}&pageNo=1&pageSize=999`,
    method: 'get',
    data
  })
}
//入库子列表
export function getInTaskGoodsByTaskId(data) {
  return request({
    url: `/wms/boundTask/getInTaskGoodsByTaskId?taskId=${data.taskId}&pageNo=1&pageSize=999`,
    method: 'get',
    data
  })
}

//同步查询出库商品
export function getOutGoodsListForAllot(data) {
  return request({
    url: `/wms/wmsWarehouse/getOutGoodsListForAllot?id=${data.id}&warehouseId=${data.warehouseId}`,
    method: 'get',
    data
  })
}
//仓库是否被删除
export function wmsWarehouseQueryByIdIsExist(data) {
  return request({
    url: `/wms/wmsWarehouse/queryByIdIsExist?id=${data.id}`,
    method: 'get',
    data
  })
}
//物品是否被删除
export function goodsQueryByIdIsExist(data) {
  return request({
    url: `/wms/goods/queryByIdIsExist?id=${data.id}`,
    method: 'get',
    data
  })
}
//客户是否被删除
export function customerQueryByIdIsExist(data) {
  return request({
    url: `/salemgt/erpCustomer/queryByIdIsExist?id=${data.id}`,
    method: 'get',
    data
  })
}
//供应商是否被删除
export function supplierQueryByIdIsExist(data) {
  return request({
    url: `/purchasemgt/erpPurchaseContract/queryByIdIsExist?id=${data.id}`,
    method: 'get',
    data
  })
}
//暂存-提交
export const pmDraftSave = (params) => putAction("/pm/draft/save", params)
//暂存-查询
export const pmDraftGet = (params) => getAction("/pm/draft/get", params)
//暂存-查询
export const pmDraftDel = (params) => deleteAction("/pm/draft/del", params)